<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8" import="java.sql.*"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
<link rel="stylesheet" type="text/css" href="css.css">
</head>
<body>
<%
	   Class.forName("com.mysql.jdbc.Driver");//加载驱动
	   String url="jdbc:mysql:///directroute";
	   String user="root";
	   String password="root";
	   Connection con = DriverManager.getConnection(url, user, password);
	   Statement st=con.createStatement();
	   ResultSet rs=null;
	   String username=(String)session.getAttribute("username");
	   String sql="select * from employee where name="+username;
	   rs=st.executeQuery(sql);
	  
	   while(rs.next()){
		   String id = rs.getString("id");
		   request.setAttribute("id", id);
		   String name = rs.getString("name");
		   request.setAttribute("name", name);
		   String sex = rs.getString("sex");
		   request.setAttribute("sex", sex);
		   String number = rs.getString("num");
		   request.setAttribute("num", number);
		   String pass = rs.getString("password");
		   request.setAttribute("password", pass);
	          }
	    
%>
登录账号：${username}
<h1 align="center">个人信息主页</h1>
<div class="demo1">
    <img  src="1.png">
</div>
<form method="post" action="update.jsp?id=${id }">
<div class="demo2">
  <table align="center">
      <tr><td>姓名：       </td><td><input type="text"  value="${name }" name="name"/></td></tr>
      <tr><td>性别：       </td><td><input type="radio"  name="gender" value="${sex}" checked="checked"/>${sex==0?"女":"男" }<input type="radio"  name="gender" value="${sex}"/>${sex==0?"男":"女" }</td></tr>
      <tr><td>工号：</td><td><input type="text"   value="${num }"/></td></tr>
      <tr><td>密码：</td><td><input type="text" name="password" value="${password }"/></td></tr>
      <tr><td></td><td><input type="submit" value="保存"/></td></tr>
  </table>
  </div>
</form>

</body>
</html>